<template>
  <div>
    <table-box ref="tableBox" show-index no-request :data="tableData" :other-filters="filtersRaw" :table-config="tableConfig" />
    <PrototypeRoomDetail ref="prd" />
  </div>
</template>
<script>
import PrototypeRoomDetail from './prototypeRoomDetail'
export default {
  name: 'PrototypeRoom',
  components: {
    PrototypeRoomDetail
  },
  props: {
    customerCode: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      tableData: [],
      tableConfig: {
        interfacePath: `${process.env.VUE_APP_BASE_API}/api/v1/modelRoomInfo/page`,
        hideSearchBar: true,
        tabIndex: 16,
        setting: [
          {
            prop: 'modelRoomTaskCode',
            label: '样板间任务编码',
            className: 'btn-green',
            minWidth: 150,
            isButton: true,
            clickFun: this.toDetail
          },
          {
            prop: 'modelRoomTaskName',
            label: '样板间任务名称',
            minWidth: 130
          },
          {
            prop: 'communityName',
            label: '小区名称',
            minWidth: 120
          },
          {
            prop: 'submissionDate',
            label: '提报月份',
            minWidth: 100
          },
          {
            prop: 'houseDeliveryTime',
            label: '交楼日期',
            minWidth: 140
          },
          {
            prop: 'modelRoomBuildSchedule',
            label: '样板间建设进度',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'YBJ_CONSTRUCTION_STEP'
            }
          },
          {
            prop: 'isAccessoriesOrder',
            label: '样板间是否已下单',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'isCompletionAcceptance',
            label: '是否验收',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'finalAcceptanceResult',
            label: '验收结果',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'YBJ_FINAL_CHECK_RESULE'
            }
          },
          {
            prop: 'isApplyRebate',
            label: '是否申请返利',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'isExecuteRebate',
            label: '是否执行返利',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'isOperation',
            label: '是否运营',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'realOperationStartTime',
            label: '运营时间（起）',
            minWidth: 100
          },
          {
            prop: 'realOperationEndTime',
            label: '运营期限（止）',
            minWidth: 100
          },
          {
            prop: 'modelRoomOperateState',
            label: '运营状态',
            minWidth: 100,
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'YBJ_OPERATION_STATUS'
            }
          }
        ]
      }
    }
  },
  computed: {
    filtersRaw() {
      return [{ id: 'customerCode', property: 'customerCode', value: this.customerCode, operator: '=' }]
    }
  },
  mounted() {
    this.refreshTableData()
  },
  methods: {
    toDetail(row) {
      this.$refs.prd.openDialog(row.id)
    },
    refreshTableData(type) {
      this.$nextTick(() => {
        this.$refs.tableBox.initTableData(type)
      })
    }
  }
}
</script>
